<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <script type="text/javascript">
			var path="<%=path%>";
	</script>
    <title>个人需求方认证展示页面</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="<%=path%>/js/jquery/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/extJquery.js"></script>
	<script type="text/javascript" src="<%=path %>/js/adminLogin.js"></script>
	<script type="text/javascript" language="javascript"> 
	$(function(){ 
		$("#userLocationCode0").unbind("change", eDropLangChange).bind("change", eDropLangChange); 
		$("#userLocationCode").unbind("change", eDropFrameChange).bind("change", eDropFrameChange); 
	}); 
	var eDropLangChange = function(){ 
		var selectedValue = $(this).val(); 
		$("#userLocationCode").children("span").each(function(){ 
			$(this).children().clone().replaceAll($(this)); 
		}); 

		if(parseInt(selectedValue) != 0){ 
			$("#userLocationCode").children("option[parentid!='" + selectedValue + "'][value!='0']").each(function(){ 
				$(this).wrap("<span style='display:none'></span>"); 
			}); 
		} 
	}; 
	var eDropFrameChange = function(){  
		$("#userLocationCode0").val($(this).children("option:selected").attr("parentid")); 
	}; 
	
	
	
	/*	2014年9月1日21:36:07                          */
	/*=======================================*/
	$(document).ready(function(){
		
	});
	
	//表单提交新增失败后,返回回调函数,传回错误信息
	function uploadSucced(msg){
	//	var btn = $("#createPeriadBtn");
	//	btn.button('reset');
		$("#firstUploadSucceedMsg").html(msg);
		$("#firstUploadSucceed").show();
		$("#firstUploadFailed").hide();
		var strs = new Array();
		strs = msg.split("&");
		if(strs[1]=="1"){
			document.getElementById("userCertFrontPhotoImg").src=path + strs[0];
			$("#userCertFrontPhotoUrlInput").val(strs[0]);
		}else if(strs[1]=="0"){
			document.getElementById("userCertObversePhotoImg").src=path + strs[0];
			$("#userCertObversePhotoUrlInput").val(strs[0]);
		}
	}
	//表单提交修改失败后，传回提示信息
	function uploadFailed(msg){
	//	var btn = $("#updateperiadBtn");
	//	btn.button('reset');
		$("#firstUploadFailedMsg").html(msg);
		$("#firstUploadFailed").show();
		$("#firstUploadSucceed").hide();
	}
	
	</script> 
  </head>
  
  <body style="text-align: center">
    <h1>这里是个人需求方认证页面</h1>
    <br>
 	<form id="perDemindCertifyForm" >
 	
     	<div id="errmsg"  style="color: #FFFFFF; font-size: 12px; ">&nbsp;</div>
		<br>
		*真实姓名:<input type="text" name="userName" id="userName" value="${user.userName}">
		<br>
		*证件类型:<select id="userCertTypeCode" name="userCertTypeCode">
					<c:if test="${!empty certs}">
						<c:forEach var="cert" items="${certs}">
							<c:if test="${cert.codeId==user.userCertTypeCode}">
								<option value="${cert.codeId }" selected="selected">${cert.codeDesc}</option>
							</c:if>
							<c:if test="${cert.codeId!=user.userCertTypeCode}">
								<option value="${cert.codeId }">${cert.codeDesc}</option>
							</c:if>
						</c:forEach>
					</c:if>
                 </select>
		<br>
		*证件号码:<input type="text" name="userCertNo" value="${user.userCertNo }" id="userCertNo" >
		<br>
		*手机号码:<input type="text" value="${user.userMobile }" name="userMobile" id="userMobile" >
		<br>
		*电子邮箱:<input type="text" name="userEmail" id="userEmail" value="${user.userEmail }">
		<br>
		*所在地区:<select id="userLocationCode0" name="userLocationCode0"> 
					<option value="0" selected="selected">--省份--</option> 
					<c:if test="${!empty locations}">
						<c:forEach var="location" items="${locations}">
							<c:if test="${location.locationCode==location.pLocationCode}">
								<c:if test="${location.locationCode==(user.userLocationCode/1000)}">
									<option value="${location.locationCode}" selected="selected">${location.locationName}</option>
								</c:if>
								<c:if test="${location.locationCode!=(user.userLocationCode/1000)}">
									<option value="${location.locationCode}">${location.locationName}</option>
								</c:if>
							</c:if>
						</c:forEach>
					</c:if> 
				</select> 
				<select id="userLocationCode" name="userLocationCode"> 
					<option value="0" selected="selected">--城市-- </option>
					<c:if test="${!empty locations}">
						<c:forEach var="location" items="${locations}">
							<c:if test="${location.locationCode!=location.pLocationCode}">
								<c:if test="${location.locationCode==user.userLocationCode }">
									<option value="${location.locationCode}" parentid="${location.pLocationCode}" selected="selected">${location.locationName}</option>
								</c:if>
								<c:if test="${location.locationCode!=user.userLocationCode }">
									<option value="${location.locationCode}" parentid="${location.pLocationCode}" >${location.locationName}</option>
								</c:if>
							</c:if>
						</c:forEach>
					</c:if> 
				</select> 

		<br>
		*详细地址:<input type="text" name="userAddrDetail" value="${user.userAddrDetail }" id="userAddrDetail" >
		<br>
		*当前职务:<input type="text" name="userCurrPosition" value="${user.userCurrPosition }" id="userCurrPosition" >
		<br>
		*行业工作年限:<input type="text" name="userWorkYears" value="${user.userWorkYears }" id="userWorkYears" ></div>
		<br>
		*备用联系人姓名:<input type="text" value="${user.backupContactPersonName}" name="backupContactPersonName" id="backupContactPersonName" >
		<br>
		*备用联系人手机:<input type="text" value="${user.backupContactPersonMobile}" name="backupContactPersonMobile" id="backupContactPersonMobile" >    
		<br>
		
		<input type="hidden" value="${user.userCertFrontPhotoUrl}" name="userCertFrontPhotoUrl" id="userCertFrontPhotoUrlInput" >    
		<input type="hidden" value="${user.userCertObversePhotoUrl}" name="userCertObversePhotoUrl" id="userCertObversePhotoUrlInput" >    
	<!-- 	*个人身份证正面:<input type="file" value="" name="userCertFrontPhotoUrl" id="userCertFrontPhotoUrl" >
		<br>
		*个人身份证反面:<input type="file" value="" name="userCertObversePhotoUrl" id="userCertObversePhotoUrl" >    
		<br> -->
	</form>

   	<form id ="firstUpdateForm" action="<%=path%>/user/uploadFile.do?imgType=1" method="post"
	    enctype="multipart/form-data" class="form-horizontal" role="form" target="hidden_frame">
		    *个人身份证正面:<input type="file" id="firstDemoImgFile" name="imgFile">
		<%=path%>
		<c:if test="${user.userCertFrontPhotoUrl != null}">
			<br>
			<img style="width:200px;" id="userCertFrontPhotoImg" src="<%=path%>${user.userCertFrontPhotoUrl}" />
			<br>
		</c:if>
		<c:if test="${user.userCertFrontPhotoUrl == null}">
			<br>
			<img style="width:200px;" id="userCertFrontPhotoImg" src="<%=path%>/img/test.jpg" />
			<br>
		</c:if>
		
	    <button id="createPeriadBtn" type="submit" class="btn btn-default">上传</button>
	</form> 
		<form id ="firstUpdateForm" action="<%=path%>/user/uploadFile.do?imgType=0" method="post"
	    enctype="multipart/form-data" class="form-horizontal" role="form" target="hidden_frame">
		    *个人身份证反面:<input type="file" id="firstDemoImgFile" name="imgFile">
		<c:if test="${user.userCertObversePhotoUrl != null}">
			<br>
			<img style="width:200px;" id="userCertObversePhotoImg"src="<%=path%>${user.userCertObversePhotoUrl}" />
			<br>
		</c:if>
		<c:if test="${user.userCertObversePhotoUrl == null}">
			<br>
			<img style="width:200px;" id="userCertObversePhotoImg"src="<%=path%>/img/test.jpg" />
			<br>
		</c:if>
	    <button id="createPeriadBtn" type="submit" class="btn btn-default">上传</button>
	</form> 
	<div id="firstUploadSucceed" style="display: none;">
	    <strong>文件上传成功！</strong></span>
	</div>
	<div id="firstUploadFailed" style="display: none;">
	    <strong>文件上传失败！</strong></span>
	</div>
	<iframe name='hidden_frame' id="hidden_frame" style='display:none'></iframe>
	<a href="javascript:perDemindCertify();">提交</a>
  </body>
</html>
